package com.tsp_tux.demo.Util;

import com.tsp_tux.demo.Entity.RespBean;

/**
 * 让一些简单的返回更加便捷
 * <p>
 *
 * @author 沈育洋
 */
public final class easyRespBean {

    public static RespBean ok() {
        return okWithMsg("success");
    }

    public static RespBean okWithMsg(String msg) {
        return new RespBean(200, msg, null);
    }

    public static RespBean ok(Object data) {
        return new RespBean(200, "success", data);
    }

    public static RespBean ok(String msg, Object data) {
        return new RespBean(200, msg, data);
    }

    public static RespBean err() {
        return errWithMsg("error");
    }

    public static RespBean errWithMsg(String msg) {
        return new RespBean(500, msg, null);
    }

    public static RespBean noFound() {
        return noFoundWithMsg("no found");
    }

    public static RespBean noFoundWithMsg(String msg) {
        return new RespBean(404, msg, null);
    }
}
